import { createRouter, createWebHistory } from 'vue-router'

import type { App } from 'vue'
import type { RouteRecordRaw } from 'vue-router'

const frontRoutes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'home',
    component: () => import('@/pages/frontend/index.vue')
  }
]

const admingRoutes: RouteRecordRaw[] = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/pages/admin/login.vue')
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes: [...frontRoutes, ...admingRoutes]
})

export default (app: App) => {
  app.use(router)
}
